package cn.study.cas.unsafe;

import sun.misc.Unsafe;

/**
 * @Author     ：跟大 佳一 起学 架构
 * @Description：ObjectMonitorRunner
 */
public class ObjectMonitorRunner {
    static Object object = new Object();
    static Unsafe unsafe = UnsafeInstance.reflectGetUnsafe();
    public static void main(String[] args) {
        //jvm内置锁
        synchronized (object){
            //写逻辑
        }
        // unsafe锁  等价于
        unsafe.monitorEnter(object);
        //写逻辑
        unsafe.monitorExit(object);
    }
}
